package com.spzx.product.api;

import com.spzx.common.core.constant.SecurityConstants;
import com.spzx.common.core.constant.ServiceNameConstants;
import com.spzx.common.core.domain.R;
import com.spzx.product.api.domain.ProductSkuVo;
import com.spzx.product.api.domain.SkuPriceVo;
import com.spzx.product.api.factory.RemoteProductFallbackFactory;
import io.swagger.v3.oas.annotations.Parameter;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * ClassName: RemotrProductService
 * Package: com.spzx.product.api
 * Description:
 *
 * @Author 王颖轩
 * @Create 2024/12/29 17:34
 * @Version 1.0
 */

@FeignClient(
        value = ServiceNameConstants.PRODUCT_SERVICE,
        fallbackFactory = RemoteProductFallbackFactory.class
        )

public interface RemoteProductService {
    @GetMapping("/productSku/getProductSku/{skuId}")
    R<ProductSkuVo> getProductSkuVo(
            @Parameter(description = "商品skuId")
            @PathVariable("skuId") Long skuId,

            @RequestHeader(SecurityConstants.FROM_SOURCE) //"from-source"
            String source);

    @GetMapping(value = "/productSku/getSkuPrice/{skuId}")
    R<SkuPriceVo> getSkuPrice(@PathVariable("skuId") Long skuId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @PostMapping(value = "/productSku/getSkuPriceList")
    R<List<SkuPriceVo>> getSkuPriceList(
            @RequestBody List<Long> skuIdList,
            @RequestHeader(SecurityConstants.FROM_SOURCE) String source
    );
}


